package com.yeepay.skb.biz;


import com.yeepay.skb.util.Conts;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.apache.commons.httpclient.methods.multipart.StringPart;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 垫资额度查询
 */
public class QueryRJTBalanceBuilder extends YeepayBuilder{

    protected List<Part> parts = new ArrayList<Part>(11);
    protected String url= Conts.baseRequestUrl + "/queryRJTBalance.action";

    private ArrayList<String> needHmac=new ArrayList<>(Arrays.asList(
            "totalLimit",
            "tempLimit",
            "fixedLimit",
            "percentage",
            "leftLimit",
            "currentDate"
    ));

    public Part[] generateParams() {
        return parts.toArray(new Part[parts.size()]);
    }

    public QueryRJTBalanceBuilder setMainCustomerNumber(String mainCustomerNumber) {
        this.parts.add(new StringPart("mainCustomerNumber", mainCustomerNumber == null ? "" : mainCustomerNumber, "UTF-8"));
        return this;
    }

    public void setHmac(String hmac) {
        this.parts.add(new StringPart("hmac", hmac == null ? "" : hmac, "UTF-8"));
    }

    @Override
    public List<String> needHmacArr() {
        return needHmac;
    }

    public List<Part> getParts() {
        return parts;
    }

    @Override
    public String getUrl() {
        return url;
    }
}